﻿using System.Windows.Input;

//定义命令和快捷方式，
namespace BooksDemo.Commands
{
  public static class BooksCommands
  {
    private static RoutedUICommand s_showBook;
   //ShowBook
    //public static ICommand ShowBook =>
    //    s_showBook ?? (s_showBook = new RoutedUICommand("Show Book", "ShowBook", typeof(BooksCommands)));

    //ShowBook
    public static ICommand ShowBook
    {
        get
        {
            if (s_showBook == null)
            {
                s_showBook = new RoutedUICommand("Show Bookdad", "ShowBook", typeof(BooksCommands));
                s_showBook.InputGestures.Add(new KeyGesture(Key.C, ModifierKeys.Alt));
            }
            return s_showBook;

        }
    }

    private static RoutedUICommand s_showBooksList;
    //ShowBooksList
    public static ICommand ShowBooksList
    {
      get
      {
        if (s_showBooksList == null)
        {
          s_showBooksList = new RoutedUICommand("Show Bookso", "ShowBooks", typeof(BooksCommands));
          s_showBooksList.InputGestures.Add(new KeyGesture(Key.B, ModifierKeys.Alt));//Alt+B组合键调用ShowBooksList命令
                }
        return s_showBooksList;
      }
    }

    private static RoutedUICommand s_showBooksGrid;
        public static ICommand ShowBooksGrid =>
            s_showBooksGrid ?? (s_showBooksGrid = new RoutedUICommand("Show Books Grid", "ShowBooksGrid", typeof(BooksCommands)));

    private static RoutedUICommand s_showAuthors;
    public static ICommand ShowAuthors =>
        s_showAuthors ?? (s_showAuthors = new RoutedUICommand("Show Authors", "ShowAuthors", typeof(BooksCommands)));
  }
}
